package com.shuyu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shuyu.domain.ActivityProduct;
import com.shuyu.vo.PointMailVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ActivityProductMapper extends BaseMapper<ActivityProduct> {
    @Select("select t1.*,t2.type,t2.name as product_name,t2.price  " +
            "from tbl_activity_product t1 " +
            "left join tbl_product t2 on t1.product_id = t2.id " +
            "where t2.`status`= 0 and t2.del_flag=0 and t1.activity_id = #{activityId}")
    List<ActivityProduct> getProductListByActivityId(int activityId);

    @Select("select t1.id as activity_product_id,t1.product_id ,t1.`point`,t3.name as product_name,t3.img,t3.introduction  " +
            "from tbl_activity_product t1 " +
            "left join tbl_activity t2 on t1.activity_id =t2.id " +
            "left join tbl_product t3 on t1.product_id =t3.id " +
            "where  t2.start_time <= current_timestamp() and t2.end_time >=current_timestamp() and t2.status=0 " +
            "and t2.`type` =4 and t3.status =0 and t3.del_flag = 0 ")
    List<PointMailVo> getPointMail();
}
